<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>精细化节点管理汇总</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<script src="../scripts/boot.js" type="text/javascript"></script>
</head>

<body>
<style type="text/css">
	* { padding:0px margin:0px; }
	.wxftitle { width:100%; padding:10px 0px 20px 0px; font-weight:bold; text-align:center; font-size:22px; }
	.wxftable { width:96%; margin:0px auto; border-collapse:collapse; }
	.wxftable td { padding:10px 0px; border:1px solid #d2d2d2; text-align:center; font-size:16px; }
	.wxftable td a { color:#0082ff; cursor:pointer; }
	.wxftable td a:hover { font-weight:bold; }
	.wxftable .firstTr { background-color:#E5EDF3; }
	.wxfload td { width:100%; height:300px; line-height:300px; text-align:center; font-size:24px; font-weight:bold; color:#747474; border:none; }
</style>

<div id="wxftitle" class="wxftitle"></div>
<table id="wxftable" class="wxftable">
	<tr class="wxfload"><td>数据生成中...</td></tr>
</table>
</body>

<script type="text/javascript">
	var basepath = window.location.pathname + "/../";
	let dailyDate = '${dailyDate}';
	mini.parse();
	$.ajax({
		url: "dailyListData?dailyDate="+dailyDate,
		type: "post",
		dataType: "json",
		cache: false,
		success: function(resultBean){
			if(!resultBean.res){
				mini.alert(resultBean.msg);
				return;
			}
			data = resultBean.data;
			if(data) {
				// 设置标题
				$("#wxftitle").html(data.title);
				// 设置表格内容
				var tableStr = '<tr class="firstTr"><td width="12%">员额法官</td><td width="12%">总案件数</td><td width="12%">正常案件</td><td width="12%">逾期案件</td><td>逾期节点</td><td width="12%">逾期案件数</td><td width="12%">逾期天数(最多天数)</td></tr>';
				var list = data.detail;
				for(var i=0; i<list.length; i++) {
					var nodelist = list[i].overNode;
					if(nodelist.length == 0) {
						tableStr += '<tr>';
						tableStr += '<td>' + list[i].name + '</td>';
						tableStr += '<td><a personId="' + list[i].id + '" type="sumCase">' + list[i].sumCase + '</a ></td>';
						tableStr += '<td><a personId="' + list[i].id + '" type="normalCase">' + list[i].normalCase + '</a ></td>';
						tableStr += '<td><a personId="' + list[i].id + '" type="overCase">' + list[i].overCase + '</a ></td>';
						tableStr += '<td>——</td>';
						tableStr += '<td>——</td>';
						tableStr += '<td>——</td>';
						tableStr += '</tr>';
					} else {
						for(var j=0; j<nodelist.length; j++) {
							tableStr += '<tr>';
							if(j == 0) {
								tableStr += '<td rowspan="' + nodelist.length + '">' + list[i].name + '</td>';
								tableStr += '<td rowspan="' + nodelist.length + '"><a personId="' + list[i].id + '" type="sumCase">' + list[i].sumCase + '</a ></td>';
								tableStr += '<td rowspan="' + nodelist.length + '"><a personId="' + list[i].id + '" type="normalCase">' + list[i].normalCase + '</a ></td>';
								tableStr += '<td rowspan="' + nodelist.length + '"><a personId="' + list[i].id + '" type="overCase">' + list[i].overCase + '</a ></td>';
							}
							tableStr += '<td>' + nodelist[j].nodeName + '</td>';
							tableStr += '<td><a clickType="true" personId="' + list[i].id + '" nodeId="' + nodelist[j].nodeId + '">' + nodelist[j].nodeCase + '</a ></td>';
							tableStr += '<td>' + nodelist[j].nodeDay + '</td>';
							tableStr += '</tr>';
						}
					}
				}
				$("#wxftable").html(tableStr);
				// 设置点击事件
				$("#wxftable a").click(function() {
					var clickType = $(this).attr("clickType");
					if(clickType == "true") {
						// 点击的是逾期案件数
						var personId = $(this).attr("personId");
						var nodeId = $(this).attr("nodeId");
						var date = data.date;
						showDailyDetail('overCase',personId,nodeId);
						//alert("人员ID是"+ personId +"  ***  节点ID是是" + nodeId + "  ***  时间是" + date );
					} else {
						// 点击的是总案件数 正常案件 逾期案件
						var personId = $(this).attr("personId");
						var type = $(this).attr("type"); // sumCase : 总案件数   normalCase : 正常案件   overCase : 逾期案件
						var date = data.date;
						showDailyDetail(type,personId,'');
						//alert("人员ID是"+ personId +"  ***  类型是" + type + "  ***  时间是" + date );
					}
				});
			} else {
				$("#wxftable").html('<tr class="wxfload"><td>数据加载失败...</td></tr>');
			}

		},
		error: function(jqXHR, textStatus, errorThrown) {
			$("#wxftable").html('<tr class="wxfload"><td>数据加载失败...</td></tr>');
		}

	});

	function showDailyDetail(type,userId,taskId){
		mini.open({
			url : basepath+"dailyDetail?type="+type+"&userId="+userId+"&taskId="+taskId,
			title : "案件详情",
			width : 1200,
			height : 700,
			allowResize: false,
			onload : function() {
			},
			ondestroy : function(action) {
			}
		});
	}

</script>

</html>